<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <button id="all">全选</button>
    <button id="qbx">全不选</button>
    <button id="fx">反选</button>
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <input type="checkbox">
    <script>
       var all=document.getElementById('all');
       var tag1=document.getElementsByTagName('input');
       var tag2=document.getElementById('qbx');
       var tag3=document.getElementById('fx');
       all.onclick=function(){
           for(var i=0;i<tag1.length;i++){
               tag1[i].checked=true;
           }
       }   
       tag2.onclick=function(){
            for(var i=0;i<tag1.length;i++){
               tag1[i].checked=false;
           }
       }
       tag3.onclick=function(){
        for(var i=0;i<tag1.length;i++){
            tag1[i].checked=!tag1[i].checked
           }
       }
        
    </script>
</body>
</html>